package com.eos.common.tool;

import java.util.HashMap;
import java.util.Map;

import com.hf.utils.BeanXmlParse;
import com.hf.utils.PropertiesParser;

/**
 * 系统初始化后台服务Servlet，需要则在web.xml中配置自动启动即可
 * 
 * @author Administrator
 * 
 */
public class WebStartServiceThread extends Thread {
	public final static Map<String, String> CORE_KEY_MAP = new HashMap<String, String>();
	public final static Map<String, String> dataAccessMap = new HashMap<String, String>();
	static {
		CORE_KEY_MAP.clear();
		PropertiesParser parser = new PropertiesParser();
		CORE_KEY_MAP.putAll(parser.readPropertiesMap("database_key"));//加载database_key.properties资源文件的键值对
		CORE_KEY_MAP.putAll(parser.readPropertiesMap("core_key"));//加载core_key.properties资源文件的键值对
		parser = null;

		dataAccessMap.clear();
		BeanXmlParse beanXmlParse = new BeanXmlParse();
		dataAccessMap.putAll(beanXmlParse.getBeans("orm_dao_bean.xml"));// 获取orm_dao_bean.xml配置文件的所有键值对
		beanXmlParse = null;
	}

	@Override
	public void run() {
		DaoAccessObjectPoolContextFactory.getInstaAccessObjectPoolContext()
				.init();// 初始化业务层获取数据DAO层对象的工厂类
	}
}
